void main() {
  // 准备购物车数据
  List carts = [
    {"count": 2, "price": 10.0, "selected": true},
    {"count": 1, "price": 30.0, "selected": false},
    {"count": 5, "price": 20.0, "selected": true}
  ];

  var res = fn(carts);
  print(res ? ' 全选' : '非全选');
}

bool fn(List list) {
  bool isSelectAll = true;
  // 判断是否全选
  list.forEach((item) {
    if (item['selected'] == false) {
      isSelectAll = false;
    }
  });
  return isSelectAll;
}
